Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up WSDL parsing #1218

Merged
merged 1 commit into from
Jun 14, 2024
Merged

Speed up WSDL parsing #1218

merged 1 commit into from
Jun 14, 2024

Conversation

tomquist
Copy link
Contributor

@tomquist tomquist commented May 4, 2023

We were running into performance issues while generating a SOAP client. I profiled the client generation and identified two bottlenecks in parsing WSDL files:

  • When visiting an unexpected node an error got constructed that was discarded later on in non-strict mode. Constructing an error is pretty expensive because Node needs to capture the stack.
  • splitQName split the entire nsName string even though it's only interested in the first element

We were running into performance issues while generating a SOAP client.
I profiled the client generation and identified two bottlenecks in parsing WSDL files:
- When visiting an unexpected node an error got constructed that was discarded later on in non-strict mode. Constructing an error is pretty expensive because Node needs to capture the stack.
- splitQName split the entire nsName string even though it's only interested in the first element
assert.ok(client.lastElapsedTime);
assert.ok(client.lastElapsedTime !== undefined);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be flaky on my machine because it's 0 sometimes (and more likely with this change), which is falsy. However, we're only interested in the existence of the value.

Comment on lines +189 to +193
public startElement(stack: Element[], nsName: string, attrs, options: IWsdlBaseOptions, schemaXmlns) {
const child = new UnexpectedElement(nsName, attrs, options, schemaXmlns);
child.init();
stack.push(child);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This short-circuits the allowedChildren lookup.

@w666
Copy link
Collaborator

w666 commented Apr 26, 2024

Changes look good. I guess you run some performance tests, how much faster parsing now?

@w666 w666 merged commit 58e266a into vpulim:master Jun 14, 2024
@tomquist tomquist deleted the tom/speedup branch June 24, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants